package com.cse.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Util {
	/**
	 * Baidu 搜索链接前缀
	 */
	public final static String BAIDU_PRE_URL = "http://www.baidu.com/s?ie=utf-8&wd=";
	/**
	 * Bing 搜索链接前缀
	 */
	public final static String BING_PRE_URL = "http://cn.bing.com/search?q=";
	/**
	 * Easou 搜索链接前缀
	 */
	public final static String EASOU_PRE_URL = "http://i.easou.com/s.m?q=";
	/**
	 * Roboo 搜索链接前缀
	 */
	public final static String ROBOO_PRE_URL = "http://sz.roboo.com/search.htm?q=";
	/**
	 * Search360 搜索链接前缀
	 */
	public final static String SEARCH360_PRE_URL = "http://www.so.com/s?ie=utf-8&q=";
	/**
	 * Sogou 搜索链接前缀
	 */
	public final static String SOGOU_PRE_URL = "http://www.sogou.com/web?query=";
	/**
	 * Sogou 搜索链接后缀
	 */
	public final static String SOGOU_SUFFIX_URL = "&ie=utf8";
	/**
	 * Soso 搜索链接前缀
	 */
	public final static String SOSO_PRE_URL = "http://www.soso.com/q?ie=utf-8&query=";
	/**
	 * Yahoo 搜索链接前缀
	 */
	public final static String YAHOO_PRE_URL = "https://search.yahoo.com/search?ei=UTF-8&p=";
	/**
	 * Yodao 搜索链接前缀
	 */
	public final static String YODAO_PRE_URL = "http://www.yodao.com/search?q=";
	/**
	 * Yodao 搜索链接后缀
	 */
	public final static String YODAO_SUFFIX_URL = "&ue=utf8";
	/**
	 * Zhongsou 搜索链接前缀
	 */
	public final static String ZHONGSOU_PRE_URL = "http://www.zhongsou.com/third.cgi?w=";
	/**
	 * 表单中关键词输入框的 name 
	 */
	public final static String KEY_NAME = "key";
	/**
	 * 复选框被选中后的值
	 */
	public final static String CHECK_BOX_CHECKED_TAG = "on";
	/**
	 * 要传递给视图的引擎信息属性的名字
	 */
	public final static String ENGINE_INFO_ATT_NAME = "engines";
	/**
	 * 要传递给视图的搜索结果属性的名字
	 */
	public final static String SEARCH_RESULT_ATT_NAME = "result";
	/**
	 * 默认 jsp 页面的名字
	 */
	public final static String DEFAULT_JSP_NAME = "index";
	/**
	 * 搜索结果 jsp 页面的名字
	 */
	public final static String SEARCH_RESULT_JSP_NAME = "result";
	/**
	 * 每个搜索引擎返回结果的数目
	 */
	public static int EACH_ENGINE_RETURN_NUM = 5;
	
	static{
		Properties properties = new Properties();
		InputStream inputStream = Util.class.getResourceAsStream("/base.properties");
		try {
			properties.load(inputStream);
			EACH_ENGINE_RETURN_NUM = Integer.parseInt(properties.getProperty("eachReturn","5"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
